<?php
/*
 * 控制台
 */
namespace app\admin\controller;

class Index extends Comm
{
    public function index($key=null)
    {
        $model = db();
        $mysql = $model->query("select VERSION() as mysql");

        $t = time() - 3600 * 24 * 60;
        $log = db('log');
        $log->where("t < $t")->delete();//删除60天前的日志
		
        $this->assign('mysql', $mysql[0]['mysql']);
        $this->assign('nav', array('', '', ''));//导航
		
		//////////////////
        $num = 20;
        $count = $log->count();
        $this->assign('num',$num);
		$this->assign('count',$count);
				
        return $this->fetch();
    }
	
    public function indexjson($page=1)
    {
        $num=20;  //每页几条
        $pro=db('log')->order('id desc')->page($page,$num)->select();
		foreach($pro as $k=>$v){
			$pro[$k]['t'] = date("Y-m-d", $pro[$k]['t']);
		}
        return json($pro);
    }
	
	
	
}
